var express = require('express');
var router = express.Router();
var jwt = require('express-jwt'); 
var loginUserDao = require('../dao/loginUserDao');
 
/* GET users listing. */
router.get('/', function(req, res, next) {
  res.send('respond with a resource');
});
 
// 增加用户
router.post('/addUser', function(req, res, next) {
	loginUserDao.add(req, res, next);
});

// 获取全部用户   
router.get('/queryAll',jwt({secret: 'hello11'}), function(req, res, next) {
	userDao.queryAll(req, res, next);
});
// 查看当前用户 
router.post('/login', function(req, res, next){
		loginUserDao.login(req, res, next)
})

 //获取单个用户 
router.get('/query',jwt({secret: 'hello'}), function(req, res, next) {
	userDao.queryById(req, res, next);
});
 
 // 删除一个用户
router.get('/deleteUser', function(req, res, next) {
	userDao.delete(req, res, next);
});
 
//更新一个用户  
router.post('/updateUser', function(req, res, next) {
	userDao.update(req, res, next);
});
 
module.exports = router;